package com.jz.banner.screen.utils

/**
 * 创建者     Noel
 * 创建时间   2018/1/8 9:51
 * 描述	      url请求地址。
 */
object Urls {
    val NOT_SIGN_UPDATE_TYPE_BY_ANDROID_CODE_INSTALL = 0//执行 安卓代码 静默安装; 金格力安卓5、鼎橙智能安卓6、广州彩城显示屏安卓7。
    val NOT_SIGN_UPDATE_TYPE_BY_SHELL_INSTALL = 1//执行 shell指令安装
    val NOT_SIGN_UPDATE_TYPE_BY_MOBILE_INSTALL = 2//手机模式自己安装
    val SIGN_UPDATE_TYPE_BY_SHELL_INSTALL_JGL = 3//签名、执行shell指令安装，通过守护进程启动； 金格力安卓6
    val SIGN_UPDATE_TYPE_BY_SHELL_INSTALL_RD = 4//签名、执行指定action，通过广播安装； "容大彩晶品牌"、译通
    val SIGN_UPDATE_TYPE_BY_SHELL_INSTALL_JGL_A40 = 5//签名、执行shell指令安装，通过守护进程启动； 金格力安卓7

    var updateType = NOT_SIGN_UPDATE_TYPE_BY_MOBILE_INSTALL
    //var updateType = SIGN_UPDATE_TYPE_BY_SHELL_INSTALL_RD         //译通

    var fromWhere = 4//1代表是本地局域网，2、代表是线上测试网，其他代表线上正式网。
    var updateFrom = 4 //1代表是本地局域网

    //正式 生产
    private val default_server_api_url = "http://jyglsxdeviceapi.jzxnm.com/"

    //测试
    //private val default_server_api_url = "http://47.112.183.251:9503/"
    //private val default_server_img_url = "https://api.jzxnm.com/"
    private val default_server_img_url = "http://img.jzxnm.com/" // 新系统

    private val default_local_api_url = "http://192.168.1.171:8016/"
    private val default_local_img_url =  "https://admin.jzxnm.com/"//"https://api.jzxnm.com/"
    var BaseUrl: String = if (fromWhere == 1) default_local_api_url else /*SPUtils.getString(Params.BaseUrl) ?:*/ default_server_api_url
    var BaseImgUrl: String = if (fromWhere == 1) default_local_img_url else /*SPUtils.getString(Params.BaseImgUrl) ?:*/ default_server_img_url

    val apkCheckUpdateUrl: String
        get() {
            return when (updateFrom) {
                1 -> "http://192.168.1.1:8080/shopScreen.json"
                //45独立广告屏
                else -> "http://update.rdxsaj.com/v1/index?type=45"//计智
                //else -> "http://update.rdxsaj.com/v1/index?type=32"//马鞍山
            }
        }
    val BaseBG_URL: String
        get() {
            return when (fromWhere) {
                1 -> "https://api.jzxnm.com/"
                2 -> "http://192.168.1.97:2040"
                else -> "http://img.jzxnm.com/"
            }
        }

    /*图标*/
    var LOGO_URL_BLUE = "http://img.jzxnm.com/uploads/APP/jizhi_logo_blue.png"
    var LOGO_URL_WHITE = "http://img.jzxnm.com/uploads/APP/jizhi_logo_white.png"
    var LOGO_URL_APP = "http://img.jzxnm.com/uploads/APP/app_logo.png"

    var shop_screen5_default_top = "http://image.dbc61.com/uploads/images/ft_screen_top_right_banner_bg01.png"
    var shop_screen_default_top = "${BaseBG_URL}uploads/APP/shop_screen_default_top.png"
    var shop_screen_default_bottom = "${BaseBG_URL}uploads/APP/shop_screen_default_bottom.png"
    var shop_screen_default_cer = "${BaseBG_URL}uploads/APP/shop_screen_default_cer.png"
    var hll_juhe_pay_bg = "${BaseImgUrl}uploads/APP/hll_juhe_pay_bg.png"
    var login_bg = "${BaseImgUrl}uploads/APP/login_bg.png"

    var app_merchant = BaseUrl.plus("v1/index/app_merchant")
    var login_qrcode = BaseUrl.plus("v1/free/login_qrcode")
    var login_screen = BaseUrl.plus("v1/free/login_screen")
    var result = BaseUrl.plus("jump?result=")

    fun initUrl(baseUrl: String?, baseImgUrl: String?) {
        //BaseUrl = if (fromWhere == 1) default_local_api_url else baseUrl ?: default_server_api_url
       // BaseImgUrl = if (fromWhere == 1) default_local_img_url else baseImgUrl ?: default_server_img_url
        SPUtils.putString(Params.BaseUrl, if (fromWhere == 1) default_local_api_url else BaseUrl)
        SPUtils.putString(Params.BaseImgUrl, if (fromWhere == 1) default_local_img_url else BaseImgUrl)
        app_merchant = BaseUrl.plus("v1/index/app_merchant")
        login_qrcode =  BaseUrl.plus("v1/free/login_qrcode")
        login_screen = BaseUrl.plus("v1/free/login_screen")
        result = BaseUrl.plus("jump?result=")
        hll_juhe_pay_bg = "${BaseImgUrl}uploads/APP/hll_juhe_pay_bg.png"
    }
}
